def generate_magic_square(n):
    # 初始化幻方矩阵
    magic_square = [[0] * n for _ in range(n)]
    
    # 起始位置
    i, j = 0, n // 2
    
    for k in range(1, n*n + 1):
        # 填充数字
        magic_square[i][j] = k
        
        # 计算下一个位置
        new_i, new_j = (i - 1) % n, (j + 1) % n
        
        # 检查新位置是否已被填充
        if magic_square[new_i][new_j] == 0:
            i, j = new_i, new_j
        else:
            # 如果新位置已被填充，则向下移动
            i = (i + 1) % n
    
    return magic_square

def print_magic_square(magic_square):
    for row in magic_square:
        print(' '.join(str(num) for num in row))

def main():
    n = int(input())
    if n % 2 == 0:
        print("N 必须是奇数")
        return
    
    magic_square = generate_magic_square(n)
    print_magic_square(magic_square)

if __name__ == "__main__":
    main()
